package com.xhs.main.controller.yfb;

import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @create 2020-10-26 10:25
 */
@ControllerAdvice
public class NoPermissionException {
    @ExceptionHandler(UnauthorizedException.class)
    public String handleShiroException(Exception ex) {
        //无权限
        return "forward:/yfb/unauthorized.html";
    }
    @ExceptionHandler(AuthorizationException.class)
    public String AuthorizationException(Exception ex) {
//        return "权限认证失败";
        return "forward:/yfb/unauthorized.html";
    }
}
